import { default as request, cloud } from '@/framework/utils/request'

// 服务器监控列表
export function serviceWatchPage(params) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/page',
    method: 'get',
    params
  })
}

// 新增服务器监控列表
export function serviceWatchAdd(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/add',
    method: 'post',
    data
  })
}

// 修改服务器监控列表
export function serviceWatchEdit(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/edit',
    method: 'post',
    data
  })
}

// 删除
export function serviceWatchDelete(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/delete',
    method: 'post',
    data
  })
}

// 详情
export function serviceWatchDetail(params) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/detail',
    method: 'get',
    params
  })
}

// 是否链接成功
export function serviceWatchTestConnect(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/testConnect',
    method: 'post',
    data
  })
}

// 定时任务开启或关闭
export function changeTaskStatus(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServiceMonitor/changeTaskStatus',
    method: 'post',
    data
  })
}
// 下载模板
export function downloadTemplateApi() {
  return request({
    url: cloud.interfacePlatform + '/interfaceDatabaseMonitor/downloadTemplate',
    method: 'post',
    params: {
      'enclosure': '数据源监控导入模板.xlsx'
    },
    responseType: 'arraybuffer'
  })
}

// 全部导出
export function exportAll(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceDatabaseMonitor/exportAll',
    method: 'post',
    data,
    responseType: 'arraybuffer'
  })
}
// 部分导出
export function partExport(params) {
  return request({
    url: cloud.interfacePlatform + '/interfaceDatabaseMonitor/export',
    method: 'post',
    params: params,
    responseType: 'arraybuffer'
  })
}
// 导入
export function uploadApi(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceDatabaseMonitor/upload',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 服务器监控下载模板
export function downloadTemplateService() {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/downloadTemplate',
    method: 'post',
    params: {
      'enclosure': '服务器监控数据导入模板.xlsx'
    },
    responseType: 'arraybuffer'
  })
}

// 服务器全部导出
export function exportAllService(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/exportAll',
    method: 'post',
    data,
    responseType: 'arraybuffer'
  })
}

// 服务器部分导出
export function ServiceExport(params) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/export',
    method: 'post',
    params,
    responseType: 'arraybuffer'
  })
}

// 导入
export function ServiceUpload(data) {
  return request({
    url: cloud.interfacePlatform + '/interfaceServerMonitor/upload',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
